/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CCMainGUI.java
 *
 * Created on 18/09/2011, 03:34:56 PM
 */
package classcreatorgui;

import classcreator.ClassCreator;
import classcreator.abstractclasses.AbstractClass;
import classcreator.abstractclasses.AbstractFK;
import classcreator.abstractclasses.AbstractProperty;
import classcreator.abstractclasses.EnumDataType;
import classcreator.classes.ClassList;
import classcreator.classes.FkList;
import classcreator.classes.PropList;
import classcreator.classfillers.Sorters;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Samus
 */
public class CCMainGUI extends javax.swing.JFrame {

    ClassCreator clascrea = ClassCreator.getInstance();
    ArrayList<String> tiposcol = new ArrayList<String>();
    private ClassList clist;
    private FkList flist;
    private PropList plist;

    public CCMainGUI() {
        this.clist = new ClassList();
        this.plist = new PropList();
        this.flist = new FkList();
        initTiposCol();
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        txt_projectname = new javax.swing.JTextPane();
        btn_proj = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        cbx_herencia = new javax.swing.JComboBox();
        jScrollPane4 = new javax.swing.JScrollPane();
        txt_classname = new javax.swing.JTextPane();
        jLabel2 = new javax.swing.JLabel();
        btn_delcls = new javax.swing.JButton();
        btn_addcls = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        lst_clases = new javax.swing.JList();
        chk_pkcls = new javax.swing.JCheckBox();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        txt_prop = new javax.swing.JTextPane();
        cbx_tipoprop = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        btn_addprop = new javax.swing.JButton();
        chk_pk = new javax.swing.JCheckBox();
        jScrollPane3 = new javax.swing.JScrollPane();
        lst_props = new javax.swing.JList();
        btn_delprop = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        cbx_colprop = new javax.swing.JComboBox();
        jButton6 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        cbx_tipofk = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        btn_addfk = new javax.swing.JButton();
        jScrollPane7 = new javax.swing.JScrollPane();
        lst_fks = new javax.swing.JList();
        btn_delfk = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        cbx_fkref = new javax.swing.JComboBox();
        cbx_propfk = new javax.swing.JComboBox();
        jLabel11 = new javax.swing.JLabel();
        cbx_tablafk = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(CCMainGUI.class);
        setTitle(resourceMap.getString("Generador de Clases - Main.title")); // NOI18N
        setName("Generador de Clases - Main"); // NOI18N
        setResizable(false);

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        txt_projectname.setName("txt_projectname"); // NOI18N
        txt_projectname.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txt_projectnameKeyPressed(evt);
            }
        });
        jScrollPane1.setViewportView(txt_projectname);

        btn_proj.setText(resourceMap.getString("btn_proj.text")); // NOI18N
        btn_proj.setEnabled(false);
        btn_proj.setName("btn_proj"); // NOI18N
        btn_proj.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btn_projMouseClicked(evt);
            }
        });

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setName("jPanel1"); // NOI18N

        cbx_herencia.setEnabled(false);
        cbx_herencia.setName("cbx_herencia"); // NOI18N

        jScrollPane4.setName("jScrollPane4"); // NOI18N

        txt_classname.setName("txt_classname"); // NOI18N
        jScrollPane4.setViewportView(txt_classname);

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        btn_delcls.setText(resourceMap.getString("btn_delcls.text")); // NOI18N
        btn_delcls.setEnabled(false);
        btn_delcls.setName("btn_delcls"); // NOI18N
        btn_delcls.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_delclsActionPerformed(evt);
            }
        });

        btn_addcls.setText(resourceMap.getString("btn_addcls.text")); // NOI18N
        btn_addcls.setName("btn_addcls"); // NOI18N
        btn_addcls.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btn_addclsMouseClicked(evt);
            }
        });

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        lst_clases.setModel(this.clist);
        lst_clases.setName("lst_clases"); // NOI18N
        lst_clases.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lst_clasesMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(lst_clases);

        chk_pkcls.setText(resourceMap.getString("chk_pkcls.text")); // NOI18N
        chk_pkcls.setName("chk_pkcls"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
                            .addComponent(cbx_herencia, 0, 153, Short.MAX_VALUE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(106, 106, 106)
                        .addComponent(btn_delcls))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addComponent(chk_pkcls)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 99, Short.MAX_VALUE)
                                .addComponent(btn_addcls))
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addGap(16, 16, 16)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbx_herencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btn_addcls)
                    .addComponent(chk_pkcls))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 287, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(14, 14, 14)
                .addComponent(btn_delcls)
                .addContainerGap())
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel2.setName("jPanel2"); // NOI18N

        jScrollPane5.setName("jScrollPane5"); // NOI18N

        txt_prop.setEnabled(false);
        txt_prop.setName("txt_prop"); // NOI18N
        jScrollPane5.setViewportView(txt_prop);

        cbx_tipoprop.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "String", "Int", "Boolean", "Collection" }));
        cbx_tipoprop.setEnabled(false);
        cbx_tipoprop.setName("cbx_tipoprop"); // NOI18N
        cbx_tipoprop.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbx_tipopropActionPerformed(evt);
            }
        });

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        btn_addprop.setText(resourceMap.getString("btn_addprop.text")); // NOI18N
        btn_addprop.setEnabled(false);
        btn_addprop.setName("btn_addprop"); // NOI18N
        btn_addprop.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_addpropActionPerformed(evt);
            }
        });

        chk_pk.setText(resourceMap.getString("chk_pk.text")); // NOI18N
        chk_pk.setEnabled(false);
        chk_pk.setName("chk_pk"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        lst_props.setModel(this.plist);
        lst_props.setName("lst_props"); // NOI18N
        jScrollPane3.setViewportView(lst_props);

        btn_delprop.setText(resourceMap.getString("btn_delprop.text")); // NOI18N
        btn_delprop.setEnabled(false);
        btn_delprop.setName("btn_delprop"); // NOI18N
        btn_delprop.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_delpropActionPerformed(evt);
            }
        });

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        cbx_colprop.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "String", "Int", "Boolean" }));
        cbx_colprop.setEnabled(false);
        cbx_colprop.setName("cbx_colprop"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                        .addGap(117, 117, 117)
                        .addComponent(btn_delprop))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                .addComponent(chk_pk)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 127, Short.MAX_VALUE)
                                .addComponent(btn_addprop))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel5)
                                    .addComponent(jLabel4))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cbx_colprop, 0, 135, Short.MAX_VALUE)
                                    .addComponent(cbx_tipoprop, 0, 135, Short.MAX_VALUE))))))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbx_tipoprop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbx_colprop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_addprop)
                    .addComponent(chk_pk))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 278, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btn_delprop)
                .addGap(104, 104, 104))
        );

        jButton6.setFont(resourceMap.getFont("jButton6.font")); // NOI18N
        jButton6.setText(resourceMap.getString("jButton6.text")); // NOI18N
        jButton6.setName("jButton6"); // NOI18N
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel3.setName("jPanel3"); // NOI18N

        cbx_tipofk.setEnabled(false);
        cbx_tipofk.setName("cbx_tipofk"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        btn_addfk.setText(resourceMap.getString("btn_addfk.text")); // NOI18N
        btn_addfk.setEnabled(false);
        btn_addfk.setName("btn_addfk"); // NOI18N
        btn_addfk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_addfkActionPerformed(evt);
            }
        });

        jScrollPane7.setName("jScrollPane7"); // NOI18N

        lst_fks.setModel(this.flist);
        lst_fks.setName("lst_fks"); // NOI18N
        jScrollPane7.setViewportView(lst_fks);

        btn_delfk.setText(resourceMap.getString("btn_delfk.text")); // NOI18N
        btn_delfk.setEnabled(false);
        btn_delfk.setName("btn_delfk"); // NOI18N
        btn_delfk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_delfkActionPerformed(evt);
            }
        });

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        cbx_fkref.setEnabled(false);
        cbx_fkref.setName("cbx_fkref"); // NOI18N

        cbx_propfk.setEnabled(false);
        cbx_propfk.setName("cbx_propfk"); // NOI18N
        cbx_propfk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbx_propfkActionPerformed(evt);
            }
        });

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        cbx_tablafk.setEnabled(false);
        cbx_tablafk.setName("cbx_tablafk"); // NOI18N
        cbx_tablafk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbx_tablafkActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addComponent(btn_delfk)
                        .addGap(102, 102, 102))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel8)
                                    .addComponent(jLabel7)
                                    .addComponent(jLabel11)
                                    .addComponent(jLabel9))
                                .addGap(15, 15, 15)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(cbx_tablafk, 0, 128, Short.MAX_VALUE)
                                    .addComponent(cbx_propfk, 0, 128, Short.MAX_VALUE)
                                    .addComponent(cbx_tipofk, 0, 128, Short.MAX_VALUE)
                                    .addComponent(cbx_fkref, 0, 128, Short.MAX_VALUE))))
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addComponent(btn_addfk)
                        .addContainerGap())))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbx_propfk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbx_tipofk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(cbx_tablafk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbx_fkref, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGap(9, 9, 9)
                .addComponent(btn_addfk)
                .addGap(4, 4, 4)
                .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 247, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btn_delfk)
                .addGap(113, 113, 113))
        );

        jLabel10.setFont(resourceMap.getFont("jLabel10.font")); // NOI18N
        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N
        jMenu1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu1ActionPerformed(evt);
            }
        });

        jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        jMenuItem1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenuItem1MouseClicked(evt);
            }
        });
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(55, 55, 55)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 214, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(29, 29, 29)
                        .addComponent(btn_proj)
                        .addGap(186, 186, 186))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addGap(275, 275, 275))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(349, 349, 349))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(15, 15, 15))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(19, 19, 19)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1)))
                    .addComponent(btn_proj))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 463, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(8, 8, 8)
                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 463, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27)
                .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btn_projMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btn_projMouseClicked
        if (txt_projectname.isEnabled()) {
            clascrea.setPackagename(txt_projectname.getText());
            txt_projectname.setEnabled(false);
        } else {
            txt_projectname.setEnabled(true);
        }
    }//GEN-LAST:event_btn_projMouseClicked

    private void jMenuItem1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem1MouseClicked
        txt_projectname.setText("");
        txt_projectname.setEnabled(true);
        clascrea.setPackagename("");
        clearClasses();
        clearFKs();
        clearProperties();
    }//GEN-LAST:event_jMenuItem1MouseClicked

    private void btn_addclsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btn_addclsMouseClicked
        String aux = "";
        if (clascrea.searchClass(txt_classname.getText()) == null && !txt_classname.getText().equals("") && !txt_classname.getText().equals("DataBaseConnFactory") && !txt_classname.getText().equals("Main") && !txt_classname.getText().equals("Controller")) {
            if (cbx_herencia.getSelectedIndex() > -1) {
                aux = cbx_herencia.getSelectedItem().toString();
            }
            clascrea.addAbsClass(txt_classname.getText(), aux, chk_pkcls.isSelected());
            updateCList();
            updateFKList();
        }
        int size = lst_clases.getModel().getSize();
        if (size > 0) {
            btn_delcls.setEnabled(true);
        }
        cbx_herencia.setEnabled(true);
        txt_classname.setText("");
        chk_pkcls.setSelected(false);
    }//GEN-LAST:event_btn_addclsMouseClicked

    private void cbx_tipopropActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbx_tipopropActionPerformed
        if (cbx_tipoprop.getSelectedIndex() > -1) {
            if (cbx_tipoprop.getSelectedItem().toString().equals("Collection")) {
                cbx_colprop.setEnabled(true);
            } else {
                cbx_colprop.setEnabled(false);
            }
        }
    }//GEN-LAST:event_cbx_tipopropActionPerformed

    private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed
        txt_classname.setText("");
        txt_projectname.setText("");
        txt_prop.setText("");
        txt_projectname.setEnabled(true);
        lst_clases.removeAll();
        lst_clases.repaint();
        lst_fks.removeAll();
        lst_props.removeAll();
        updateFKList();
        updatePList();
        updateCList();
    }//GEN-LAST:event_jMenu1ActionPerformed

    private void lst_clasesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lst_clasesMouseClicked
        int size = lst_clases.getModel().getSize();
        if (size > 0) {
            if (lst_clases.getSelectedIndex() > (-1)) {
                AbstractClass c = clascrea.searchClass(((AbstractClass) lst_clases.getSelectedValue()).getNombreclase());
                for (AbstractProperty p : c.getProperties()) {
                    plist.addProp(p);
                }
                txt_prop.setEnabled(true);
                cbx_tipoprop.setEnabled(true);
                btn_addprop.setEnabled(true);
                chk_pk.setEnabled(true);
                updatePList();
                updateFKList();
            }
        }
    }//GEN-LAST:event_lst_clasesMouseClicked

    private void btn_addpropActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_addpropActionPerformed
        String classname = "";
        chk_pk.setSelected(false);
        if (lst_clases.getSelectedIndex() > (-1)) {
            classname = ((AbstractClass) lst_clases.getSelectedValue()).getNombreclase();
        }
        String proptipo = "";
        if (cbx_tipoprop.getSelectedIndex() > -1) {
            proptipo = cbx_tipoprop.getSelectedItem().toString();
        }
        String coltipo = "";
        if (cbx_colprop.isEnabled()) {
            if (cbx_colprop.getSelectedIndex() > -1) {
                coltipo = cbx_colprop.getSelectedItem().toString();
            }
        }
        clascrea.addAbsProp(classname, txt_prop.getText(), chk_pk.isSelected(), proptipo, coltipo);
        updatePList();
        int size = lst_props.getModel().getSize();
        if (size > 0) {
            updateFKList();
            btn_delprop.setEnabled(true);
        }
        permitFKs();
    }//GEN-LAST:event_btn_addpropActionPerformed

    private void btn_delclsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_delclsActionPerformed
        AbstractClass c = null;
        int size = lst_clases.getModel().getSize();
        if (size != 1) {
            if (lst_clases.getSelectedIndex() > (-1)) {
                c = (AbstractClass) lst_clases.getSelectedValue();
                clist.delClass(c);
                clascrea.delAbsClass(c.getNombreclase());
            }
        } else {
            clearClasses();
        }
        updateCList();
        if (size == 0) {
            btn_delcls.setEnabled(false);
        }
    }//GEN-LAST:event_btn_delclsActionPerformed

    private void cbx_propfkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbx_propfkActionPerformed
        cbx_tipofk.removeAllItems();
        if (cbx_propfk.getSelectedIndex() > -1) {
            AbstractClass c = clascrea.searchClass(((AbstractClass) lst_clases.getSelectedValue()).getNombreclase());
            String tipo = Sorters.getInstance().propSort((c.readProp(cbx_propfk.getSelectedItem().toString())).getType());
            String aux = tipo.trim();
            cbx_tipofk.addItem(aux);
        }
    }//GEN-LAST:event_cbx_propfkActionPerformed

    private void btn_delpropActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_delpropActionPerformed
        int size = lst_props.getModel().getSize();
        if (size != 1) {
            if (lst_props.getSelectedIndex() > (-1)) {
                AbstractClass c = clascrea.searchClass(((AbstractClass) lst_clases.getSelectedValue()).getNombreclase());
                AbstractProperty p = (AbstractProperty) lst_clases.getSelectedValue();
                plist.delProp(p);
                clascrea.delAbsProp(c.getNombreclase(), p.getName());
            }
        } else {
            clearProperties();
        }
        txt_prop.setText("");
        chk_pk.setSelected(false);
    }//GEN-LAST:event_btn_delpropActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        txt_classname.setText("");
        txt_projectname.setText("");
        txt_prop.setText("");
        txt_projectname.setEnabled(true);
        lst_clases.removeAll();
        lst_clases.repaint();
        lst_fks.removeAll();
        lst_props.removeAll();
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void txt_projectnameKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_projectnameKeyPressed
        if (txt_projectname.getText().length() > 0) {
            btn_proj.setEnabled(true);
        } else {
            btn_proj.setEnabled(false);
        }
    }//GEN-LAST:event_txt_projectnameKeyPressed

    private void cbx_tablafkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbx_tablafkActionPerformed
        cbx_fkref.removeAllItems();
        if (cbx_tablafk.getSelectedIndex() > -1) {
            AbstractClass c = clascrea.searchClass(cbx_tablafk.getSelectedItem().toString());
            for (AbstractProperty p : c.readPKs()) {
                cbx_fkref.addItem(p.getName());
            }
        }
    }//GEN-LAST:event_cbx_tablafkActionPerformed

    private void btn_addfkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_addfkActionPerformed
        String classname = "";
        if (lst_clases.getSelectedIndex() > (-1)) {
            classname = ((AbstractClass) lst_clases.getSelectedValue()).getNombreclase();
        }
        String propname = "";
        if (cbx_propfk.getSelectedIndex() > -1) {
            propname = cbx_propfk.getSelectedItem().toString();
        } else {
            propname = cbx_propfk.getItemAt(0).toString();

        }
        String type = cbx_tipofk.getItemAt(0).toString();
        String table = "";
        if (cbx_tablafk.getSelectedIndex() > -1) {
            table = cbx_tablafk.getSelectedItem().toString();
        } else {
            table = cbx_tablafk.getItemAt(0).toString();
        }
        String fkref = "";
        if (cbx_fkref.getSelectedIndex() > -1) {
            fkref = cbx_fkref.getSelectedItem().toString();
        } else {
            fkref = cbx_fkref.getItemAt(0).toString();
        }
        clascrea.addAbsFK(classname, propname, fkref, table, Sorters.getInstance().reversePropSort(type));
        updateFKList();
    }//GEN-LAST:event_btn_addfkActionPerformed

    private void btn_delfkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_delfkActionPerformed
        int size = lst_fks.getModel().getSize();
        if (size != 1) {
            if (lst_fks.getSelectedIndex() > -1) {
                AbstractClass c = clascrea.searchClass(((AbstractClass) lst_clases.getSelectedValue()).getNombreclase());
                AbstractFK fk = (AbstractFK) lst_fks.getSelectedValue();
                flist.delFK(fk);
                clascrea.delAbsFK(c.getNombreclase(), fk.getProperty());
            }
        } else {
            clearFKs();
        }
        updateFKList();
    }//GEN-LAST:event_btn_delfkActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        ClassCreator.getInstance().assembleClasses();
        try {
            ClassCreator.getInstance().executeAll();
        } catch (SQLException ex) {
            Logger.getLogger(CCMainGUI.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(CCMainGUI.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButton6ActionPerformed
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;


                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CCMainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CCMainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CCMainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CCMainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new CCMainGUI().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JButton btn_addcls;
    private javax.swing.JButton btn_addfk;
    private javax.swing.JButton btn_addprop;
    private javax.swing.JButton btn_delcls;
    private javax.swing.JButton btn_delfk;
    private javax.swing.JButton btn_delprop;
    private javax.swing.JButton btn_proj;
    private javax.swing.JComboBox cbx_colprop;
    private javax.swing.JComboBox cbx_fkref;
    private javax.swing.JComboBox cbx_herencia;
    private javax.swing.JComboBox cbx_propfk;
    private javax.swing.JComboBox cbx_tablafk;
    private javax.swing.JComboBox cbx_tipofk;
    private javax.swing.JComboBox cbx_tipoprop;
    private javax.swing.JCheckBox chk_pk;
    private javax.swing.JCheckBox chk_pkcls;
    private javax.swing.JButton jButton6;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JList lst_clases;
    private javax.swing.JList lst_fks;
    private javax.swing.JList lst_props;
    private javax.swing.JTextPane txt_classname;
    private javax.swing.JTextPane txt_projectname;
    private javax.swing.JTextPane txt_prop;
    // End of variables declaration//GEN-END:variables

    private void updateCList() {
        clist.removeAllElements();
        cbx_herencia.removeAllItems();
        cbx_herencia.addItem("");
        for (AbstractClass c : clascrea.getClasesAbs()) {
            clist.addClass(c);
            cbx_herencia.addItem(c.getNombreclase());
        }
    }

    private void updatePList() {
        plist.clear();
        txt_prop.setText("");
        updateCbxColProp();
        AbstractClass c = clascrea.searchClass(((AbstractClass) lst_clases.getSelectedValue()).getNombreclase());
        for (AbstractProperty p : c.getProperties()) {
            plist.addProp(p);
        }

    }

    private void updateFKList() {
        flist.clear();
        cbx_propfk.removeAllItems();
        cbx_tipofk.removeAllItems();
        cbx_fkref.removeAllItems();
        cbx_tablafk.removeAllItems();
        int size = lst_clases.getModel().getSize();
        if (size > 0) {
            List<AbstractClass> clases = clascrea.getClasesAbs();
            if (lst_clases.getSelectedIndex() > (-1)) {
                AbstractClass c = clascrea.searchClass(((AbstractClass) lst_clases.getSelectedValue()).getNombreclase());
                for (AbstractProperty p : c.getProperties()) {
                    cbx_propfk.addItem(p.getName());
                }
                for (AbstractClass cla : clases) {
                    if (!cla.getNombreclase().equals(c.getNombreclase())) {
                        cbx_tablafk.addItem(cla.getNombreclase());
                    }
                }
                for (AbstractFK f : c.getFks()){
                    flist.addFK(f);
                }
            }
        }
    }

    private void updateCbxColProp() {
        cbx_colprop.removeAllItems();
        for (String s : this.tiposcol) {
            cbx_colprop.addItem(s);
        }
        if (lst_clases.getSelectedIndex() > (-1)) {
            AbstractClass c = clascrea.searchClass(((AbstractClass) lst_clases.getSelectedValue()).getNombreclase());
            for (AbstractClass cla : clascrea.getClasesAbs()) {
                if (!c.getNombreclase().equals(cla.getNombreclase())) {
                    cbx_colprop.addItem(cla.getNombreclase());
                }
            }
        }
    }

    private void clearClasses() {
        clascrea.clearClasses();
        clist.clear();
        txt_classname.setText("");
        cbx_herencia.setEnabled(false);
        cbx_herencia.removeAllItems();
        chk_pkcls.setSelected(false);
    }

    private void clearProperties() {
        int size = lst_props.getModel().getSize();
        if (size > 0) {
            AbstractClass c = clascrea.searchClass(((AbstractClass) lst_clases.getSelectedValue()).getNombreclase());
            plist.clear();
            clascrea.clearPropsClass(c.getNombreclase());
        }
    }

    private void clearFKs() {
        int size = lst_props.getModel().getSize();
        if (size > 0) {
            AbstractClass c = clascrea.searchClass(((AbstractClass) lst_clases.getSelectedValue()).getNombreclase());
            flist.clear();
            clascrea.clearFksClass(c.getNombreclase());
        }
    }

    private void permitFKs() {
        btn_addfk.setEnabled(true);
        btn_delfk.setEnabled(true);
        cbx_propfk.setEnabled(true);
        cbx_fkref.setEnabled(true);
        cbx_tablafk.setEnabled(true);
    }

    private void initTiposCol() {
        this.tiposcol.add("String");
        this.tiposcol.add("Int");
        this.tiposcol.add("Boolean");
    }
}
